/**
* @brief fat buffer
 * @author xiaoyao
 * @file fatbuffer.h
 * @version V0.01
 * @date 2024-08-31
 */


#ifndef __FATBUFFER_H
#define __FATBUFFER_H

#ifdef __cplusplus
extern "C"
{
#endif

/* ------------------------------------------------------------------------- */
#include "stdint.h"

#define  FATBUFFER_FIRST_SIZE 1024

struct fatbuffer_s
{
    unsigned char* buffer;
    unsigned int count;
    unsigned int size;
};

int fatbuffer_init(struct fatbuffer_s* fb);
int fatbuffer_append(struct fatbuffer_s* fb, unsigned char* buf, unsigned int len);
int fatbuffer_delete(struct fatbuffer_s* fb);
int fatbuffer_clear(struct fatbuffer_s* fb);

#define FATBUFER_TEST_ENABLE 0

#if FATBUFER_TEST_ENABLE
void fatbuffer_test(void);
#endif

/* ------------------------------------------------------------------------- */

#ifdef __cplusplus
}
#endif

#endif //__FATBUFFER_H
